<?php

class ModelCatalogGallery extends Model {
    
	public function getImageForGallery() 
    {
        $imgs = array();
        
        // get the intro gallery id
		$query = $this->db->query("SELECT gallery_id FROM " . DB_PREFIX . "gallery WHERE intro_flag = 1 LIMIT 1");
	    
        if (count($query->rows) > 0) {            
            $gallery_id = (int)$query->row['gallery_id'];
            
            // get images list
            $query = $this->db->query("SELECT image FROM " . DB_PREFIX . "gallery_image WHERE gallery_id = {$gallery_id}");
            $imgs = $query->rows;            
        }
        
        return $imgs;
	}
    
}
?>